<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/admin.css">
    <title>许久没道过早安的后台</title>
    <style>
        .layui-card-header{
            height:auto;
            padding-top:15px;
            padding-bottom:10px;
        }
        .layui-inline{
            margin-right:10px;
        }
        #add{
            float:right;
        }
    </style>
</head>
<body>
<div class="body">
    <div class="layui-fluid">
        {include file='public/sider' /}
        <div id="main">
            {include file='public/header' /}

            <div class="layui-fluid" id="body">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <table id="message_lst" lay-filter="test"></table>
                    </div>
                </div>

            </div>

        </div>
    </div>
</div>
<script src="/static/layui/layui.js"></script>
<script type="text/html" id="bar">
    <a class="layui-btn layui-btn-xs" lay-event="look">查看</a>
</script>
<script>
    var height = window.screen.availHeight;
    document.getElementById('body').style.height = parseInt(height) - 190 + "px";
    document.getElementById('sider').style.height = parseInt(height) - 165 + "px";

    layui.use(['jquery','table','layer','form',],function(){
        var $ = layui.jquery;
        var table = layui.table;
        var layer = layui.layer;

        table.render({
            elem: '#message_lst',
            height: 600,
            url: "{:url('message/message_lst')}",
            page: true,
            limit: 10,
            cols:[[
                {field:'id',title:'ID',width:100,fixed:'left'},
                {field:'message',title:'留言内容'},
                {field:'add_time',title:'留言时间',width:200,sort:true},
                {title:'操作',fixed: 'right', width: 80, toolbar: '#bar'}
            ]]
        });
        table.on('tool(test)', function (obj) {
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）

            if (layEvent === 'look'){
                layer.msg(JSON.stringify(obj.data['message']));
                // window.location.href="{:url('article/article_edit')}"+"?id="+obj.data['id'];
            }
        });
    });
</script>
</body>
</html>